#ifndef KEYPAD_H_
	#define KEYPAD_H_ true

#ifndef mkKeyPadPort
	# warning "mkKeyPadPORT not define. Set default KeyPad port - PORTC"
	#define mkKeyPadPort	true
	#define	KeyPadPORT		PORTC
	#define KeyPadPIN		PINC
	#define KeyPadDDR		DDRC
#endif

#ifndef KeyPadRowsCount
#warning "KeyPadRowsCount not define. Set default - 4"
#define KeyPadRowsCount		4
#endif

#ifndef KeyPadColumnsCount
#warning "KeyPadColumnsCount not define. Set default - 4"
#define KeyPadColumnsCount	4
#endif

#define KeyPadButtonsCount	KeyPadRowsCount*KeyPadColumnsCount

struct KeyPadColumn{
	unsigned bits:KeyPadColumnsCount;
};


class clKeyPad {
	public:
	clKeyPad();
	char String[KeyPadButtonsCount + 1];
	void KeyPadScan(void);
	private:
	union{
		KeyPadColumn	Row[KeyPadRowsCount];
		bool			Bits[KeyPadButtonsCount];
	} Buttons;
	void FillCheckedMatrix(char, unsigned char const *);
	static const char KeyPadCharMatrix[KeyPadButtonsCount];
	void FillString(void);
};

#include "KeyPad.cpp"

#endif	//KEYPAD_H_
